package com.gxar.file.server.base.config;

import com.gxar.file.server.base.interception.LoginInterception;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 登录拦截器注册
 *
 * @author Linsy
 * @version 1.0
 * @created 2023/6/20
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterception loginInterception;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterception)
                .addPathPatterns("/**")
                .excludePathPatterns("/swagger/**","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui/**", "/api/file/download/**");
    }

}
